package com.pai4j.zwiki.domain.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;

import java.time.LocalDateTime;

/**
 * 论文生成实体
 * 存储论文生成的相关信息
 *
 * @author pai4j
 * @since 2025-10-12
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "pai4j_thesis_generation", indexes = {
        @Index(name = "idx_task_id", columnList = "taskId")
})
public class ThesisGenerationEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 关联的分析任务ID
     */
    @Column(nullable = false, length = 64)
    private String taskId;

    /**
     * 论文标题
     */
    @Column(nullable = false, length = 255)
    private String title;

    /**
     * 摘要
     */
    @Column(columnDefinition = "TEXT")
    private String abstractContent;

    /**
     * 关键词（JSON数组）
     */
    @Column(length = 512)
    private String keywords;

    /**
     * 项目背景与意义
     */
    @Column(columnDefinition = "LONGTEXT")
    private String background;

    /**
     * 需求分析
     */
    @Column(columnDefinition = "LONGTEXT")
    private String requirements;

    /**
     * 系统设计
     */
    @Column(columnDefinition = "LONGTEXT")
    private String systemDesign;

    /**
     * 详细设计
     */
    @Column(columnDefinition = "LONGTEXT")
    private String detailedDesign;

    /**
     * 实现与测试
     */
    @Column(columnDefinition = "LONGTEXT")
    private String implementation;

    /**
     * 总结与展望
     */
    @Column(columnDefinition = "LONGTEXT")
    private String conclusion;

    /**
     * 参考文献（JSON数组）
     */
    @Column(columnDefinition = "TEXT")
    private String references;

    /**
     * 生成的DOCX文件路径
     */
    @Column(length = 512)
    private String docxFilePath;

    /**
     * 生成的PDF文件路径
     */
    @Column(length = 512)
    private String pdfFilePath;

    /**
     * 生成的Markdown文件路径
     */
    @Column(length = 512)
    private String markdownFilePath;

    /**
     * 创建时间
     */
    @CreationTimestamp
    @Column(nullable = false, updatable = false)
    private LocalDateTime createdAt;
}

